tmp94c241: Add serial port sub-device with I/O interface mode#15015
Open
felipesanches wants to merge 1 commit intomamedev:masterfrom
Open
tmp94c241: Add serial port sub-device with I/O interface mode#15015felipesanches wants to merge 1 commit intomamedev:masterfrom
felipesanches wants to merge 1 commit intomamedev:masterfrom
Conversation
Replace the inline serial stubs (which just instantly set TX-complete) with a proper sub-device implementation supporting: - I/O interface mode (mode 0): Synchronous clocked serial using SCLK pin. Supports both internal (baud rate generator) and external (IOC=1) clock sources. TX double buffering with auto-load from buffer to shift register. Pre-outputs bit 0 on TXD before first clock edge so receiver can sample it on the rising edge. - Baud rate generator: Configurable via BRxCR register with divisor and clock source selection. Timer drives SCLK at the configured rate. Clock frequency derived from CPU clock. - TX/RX data callbacks: txd(), rxd(), sclk_out(), sclk_in() for connecting external devices to the serial ports. - tx_start callback: Signals the start of each byte transmission with the current PFFC pin function state, allowing connected devices to distinguish real transmissions from phantom ones. The serial registers (SC0BUF/SC1BUF, SC0CR/SC1CR, SC0MOD/SC1MOD, BR0CR/BR1CR) are now delegated to the sub-devices in the internal memory map. TX-complete flags (INTES0/INTES1 bit 7) are set at device_reset to indicate empty TX buffers at power-on. UART modes (7/8/9-bit) are recognized but not yet implemented. Also moves interrupt register indices from a file-scope enum to public static constexpr members of tmp94c241_device.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the inline serial stubs (which just instantly set TX-complete)
with a proper sub-device implementation supporting:
I/O interface mode (mode 0): Synchronous clocked serial using SCLK
pin. Supports both internal (baud rate generator) and external
(IOC=1) clock sources. TX double buffering with auto-load from
buffer to shift register. Pre-outputs bit 0 on TXD before first
clock edge so receiver can sample it on the rising edge.
Baud rate generator: Configurable via BRxCR register with divisor
and clock source selection. Timer drives SCLK at the configured
rate. Clock frequency derived from CPU clock.
TX/RX data callbacks: txd(), rxd(), sclk_out(), sclk_in() for
connecting external devices to the serial ports.
tx_start callback: Signals the start of each byte transmission with
the current PFFC pin function state, allowing connected devices to
distinguish real transmissions from phantom ones.
The serial registers (SC0BUF/SC1BUF, SC0CR/SC1CR, SC0MOD/SC1MOD,
BR0CR/BR1CR) are now delegated to the sub-devices in the internal
memory map. TX-complete flags (INTES0/INTES1 bit 7) are set at
device_reset to indicate empty TX buffers at power-on.
UART modes (7/8/9-bit) are recognized but not yet implemented.
Also moves interrupt register indices from a file-scope enum to
public static constexpr members of tmp94c241_device.